﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dbPoll_Application.ViewModels.PollReportViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Reports
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="pageHeadingContainer"><h2 class="pageHeading">Reports</h2></div>
    <div id="contentContainer">
        <p><%= Html.ActionLink("Reports > ", "Index", "SystemReport", null, new { @class = "breadcrumb" })%>System Utilisation Report</p>
        
        <div>
        <h3><%=Model.name%></h3>
            <% using (Html.BeginForm("SystemSessionPdf", "SystemReport", FormMethod.Post))
               { %>
               <input type="hidden" id="type" name="type" value="System Utilisation Report" />
                <input type="submit" value="Generate PDF" /><%}%>
        <table class="reports">
        <tr class="reports">
            <th class="reports">Username</th>
            <th class="reports">Access Privileges</th>
            <th class="reports">Date Created</th>
            <th class="reports">Notifications</th>
        </tr>
        
        <% 
            foreach (var user in Model.userList)
            {
        %>
       
        <tr class="reports">
            <td class="reports"><%=user.FirstName%> <%=user.LastName%></td>
            <td class="reports">
            <%
                foreach (var role in user.Roles)
                {
                    %>
                    <%=role.RoleName%><br />
                    <%
                }
            %>
            </td>
            <td class="reports"><%=user.CreationDate%></td>
            <td class="reports"><%if (user.Roles.Contains(new dbPoll_Application.Models.Role("Poll Administrator")) && user.AccountExpiryDate<= DateTime.Now.AddDays(30)){%>
                This account expires in <%=(user.AccountExpiryDate - DateTime.Now).Days%> day(s).<%} %></td>
        </tr>
   
        <%
            }
        %>
   
   </table> 
    </div>
    </div>
   
        
</asp:Content>
